const path = require('path')

module.exports = {
  productionSourceMap: false,

  devServer: {
    // host: 'sinbada.top',
    port: 9999,
    proxy: {
      '/api': {
        target: 'http://127.0.0.1',
        changeOrigin: true,
        pathRewrite: {
          '^/api': ''
        }
      }
    }
  },

  chainWebpack: config => {
    config.resolve.alias
      .set('@', resolve('src'))
      .set('packages', resolve('packages'))
      .set('lib', resolve('lib'))
  }
}

function resolve (dir) {
  return path.join(__dirname, dir)
}
